<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.text.SimpleDateFormat,java.text.DateFormat,java.util.Date"%>
<%@ include file="/WEB-INF/common/taglib.jsp" %>
<%
	Date now = new Date();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<link rel="stylesheet" href="${ctx }/static/css/Master.css"/>
	<link rel="stylesheet" href="${ctx }/static/css/lq.datetimepick.css"/>
	<link rel="stylesheet" href="${ctx }/static/css/jquery-labelauty.css"/>
	<script type="text/javascript" src="${ctx }/static/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="${ctx }/static/js/simpletooltip.min.js"></script>
	<script type="text/javascript" src="${ctx}/static/js/selectUi.js"></script>
	<script type="text/javascript" src="${ctx}/static/js/lq.datetimepick.js"></script>
	<script type="text/javascript" src="${ctx }/static/js/Common.js"></script>
	<script type="text/javascript" src="${ctx }/static/js/jsScroller.js"></script>
	<script type="text/javascript" src="${ctx}/static/js/orgCommon.js"></script>
	<script type="text/javascript" src="${ctx}/static/js/orgAreat.js"></script>
	<script type="text/javascript" src="${ctx}/static/js/layer.js"></script>
	<script src="${ctx}/static/plugins/My97DatePicker/WdatePicker.js"></script>
	<%-- 基础js,所有页面都需要引入此js,依赖layer.js --%>
   <script src="${ctx}/static/js/common/base.js"></script>
	<style type="text/css">
		#mainRight {
		  /* margin: 0 0 0 217px; */
		  height: 100%;
		  overflow: auto;
		  border-top: 1px solid #717171;
		  background: #fff;
		}
		.wrapper input{
		  height: 30px !important
		}
	</style>
	<script type="text/javascript">
	function save()
	{
		var data = $("#community").serializeJson();
		$.ajax({    
		    url:"${ctx}/community/saveCommunity.do",    
		    data:data,    
		    type:"GET",    
		    cache:false,    
		    dataType:"json",
		    async:true, //默认为true 异步 
		    success:function(data) {
		    	top.layer.alert("操作成功",function(){
		    		window.location.href = "${ctx}/community/findCommunityList.do";
		    	});
		     } 
		});
	}
	
	function open()
	{
		parent.layer.open({
		    type: 2,
		    title: '选择物业',
		    shadeClose: true,
		    offset:'30px',//垂直,水平
		    area: ['450px', '60%'],
		    fix: false, //不固定
		    maxmin: true,
		    content: '${ctx}/community/findOrgList.do', //iframe的url
		}); 
	}
	
	function callback(data)
	{
		$("#orgId").val(data.orgId);
		$("#orgName").val(data.orgName);
	}
	
	function onCheck(value)
	{
		if(value == 0)
		{
			$("#orgName").removeAttr("readonly");
			$("#combtn").attr("style","display: none");
		}else{
			$("#combtn").removeAttr("style");
			$("#orgName").attr("readonly","readonly");
		}
	}
	</script>
  </head>
  
  <body>
    <div class="wrapper">
    <form id="community" >
    	<input type="hidden" id="insertBy" name="insertBy" value="1" />
		<input type="hidden" id="lastUpdateBy" name="lastUpdateBy" value="1" />
		<input type="hidden" id="normal" name="normal" value="1" />
		<input type="hidden" id="status" name="status" value="1" />
    	<input type="hidden" id="orgId" name="orgId">
		<section>
			<section id="mainRight">
				<section class="boxRight">
					<div class="OrgTit">新增社区</div>
					<div class="context">
						<div class="add_firstmenu">
							<dl>
								<dt>
									<strong class="org">社区信息</strong>
								</dt>
								<dd></dd>
							</dl>
							<dl>
								<dt>
									<span class="im">*</span>社区名
								</dt>
								<dd>
									<input id="comName" name="comName" type="text" class="w1"/>
								</dd>
							</dl>
							<dl>
								<dt>
									<span class="im">*</span>是否认证
								</dt>
								<dd>
									<div>
										<input type="radio" name="comIsCheck" id="r1" value="1" data-labelauty="已认证" checked onclick="onCheck(this.value);">
										<label>已认证</label>&nbsp;&nbsp;&nbsp;
										<input type="radio" name="comIsCheck" id="r2" value="0" data-labelauty="未认证" onclick="onCheck(this.value);" >
										<label>未认证</label>
									</div>
								</dd>
							</dl>
							<dl>
								<dt>
									<span class="im">*</span>所属物业
								</dt>
								<dd>
									<input id="orgName" name="orgName" readonly="readonly" type="text" class="w1"/><span id="combtn" class="combtn"><a href="javascript:open();">选择物业</a></span>
								</dd>
							</dl>
							<dl>
								<dt>
									<span class="im">*</span>所在地
								</dt>
								<dd>
									<select id="province" name="provinceId" class="selectul selectul_w1 province">
										<option value="0">选择省</option>
									</select>
									<select id="city" name="cityId" class="selectul selectul_w1 city">
										<option value="0">选择市</option>
									</select>
									<select id="area" name="areaId" class="selectul selectul_w1 area">
										<option value="0">选择区</option>
									</select>
								</dd>
							</dl>
							<dl>
								<dt>
									<span class="im">*</span>详细地址
								</dt>
								<dd>
									<input id="comAddress" name="comAddress" type="text" class="w3"/>
								</dd>
							</dl>
							<dl>
								<dt>
									建筑年代
								</dt>
								<dd>
									<input id="comBuildingDate" name="comBuildingDate" type="text"  class="w1 Wdate" placeholder="建筑年代"  onclick="WdatePicker()"/>
								</dd>
							</dl>
							<dl>
								<dt>
									建筑类型
								</dt>
								<dd>
									<select id="comBuildingType" name="comBuildingType">
									 <option value="-1" checked>请选择</option>
								     <c:forEach items="${diy:getDicList('BUILDING_TYPE')}" var="dic">
								     <option value="${dic.code}" >${dic.content}</option>
								     </c:forEach>
								     </select>
								</dd>
							</dl>
							<dl>
								<dt>
									占地面积
								</dt>
								<dd>
									<input id="comFloorArea" name="comFloorArea" type="text" class="w1"/>m²
								</dd>
							</dl>
							<dl>
								<dt>
									住房数量
								</dt>
								<dd>
									<input id="comHousingNumber" name="comHousingNumber" type="text" class="w1"/>
								</dd>
							</dl>
							<dl>
								<dt>
									社区介绍
								</dt>
								<dd>
									<div class="textareaBox w2">
										<textarea id="comContent" name="comContent"></textarea>
									</div>
								</dd>
							</dl>
							<dl>
								<dt>
									<strong class="org">联系人资料</strong>
								</dt>
								<dd></dd>
							</dl>
							<dl>
								<dt>
									联系人
								</dt>
								<dd><input id="comContactName" name="comContactName" type="text" class="w1"/></dd>
							</dl>
							<dl>
								<dt>
									联系人手机号
								</dt>
								<dd><input id="comContactMobile" name="comContactMobile" type="text" class="w1"/></dd>
							</dl>
							<div class="combtn"><a href="javascript:save();">保存</a><a href="javascript:void(0);"onclick="history.go(-1)">返回</a></div>
						</div>
					</div>
			</section>
			</section>
		<!--/左边-->
		</section>
		</form>
	</div>
  </body>
</html>
